package org.example.redis.learn;

import org.springframework.context.annotation.Bean;
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.StringRedisSerializer;
import org.springframework.stereotype.Component;

@Component
public class LearnRedis {
    private static RedisTemplate<String,String> redisTemplate;
    LearnRedis(RedisTemplate<String,String> redisTemplate){
        LearnRedis.redisTemplate =redisTemplate;
    }
    public static void setValue(String key,String value){
        LearnRedis.redisTemplate.opsForValue().set(key,value);
    }

    public static String getValue(String key){
        return LearnRedis.redisTemplate.opsForValue().get(key);
    }
}
